import React from 'react'
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'

const Home = React.lazy(() => import('../pages/Home'))
const Car = React.lazy(() => import('../pages/Car'))
const Shoplist = React.lazy(() => import('../pages/Shoplist'))
const My = React.lazy(() => import('../pages/My'))

import Tabbars from '../components/Tabbar'

export default function AppRouter() {
    return (
        <div>
            {/* 配置一级路由 */}
            <BrowserRouter>
                {/* 底部导航栏 */}
                <Tabbars></Tabbars>
                <Routes>
                    <Route path='/home' element={<Home />} />
                    <Route path='/car' element={<Car />} />
                    <Route path='/shoplist' element={<Shoplist />} />
                    <Route path='/my' element={<My />} />
                    <Route path='/' element={<Navigate to='/home' />} />
                </Routes>
            </BrowserRouter>
        </div>
    )
}
